__________________________________________________________________________________________________
class Solution(object):
    def maxNumberOfApples(self, A):
        A.sort()
        space = 5000
        ans = 0
        for x in A:
            if space >= x:
                space -= x
                ans += 1
        return ans
__________________________________________________________________________________________________

__________________________________________________________________________________________________
